#include "shm.hpp"
#include "namedPipe.hpp"

int main()
{
    //创建共享内存
    Shm shm(pathname, proj_id, User);
    shm.zero();
    char* shmaddr = (char*)shm.GetShmaddr();

    //创建管道
    NamedPipe pipe("./myfifo", User);
    if(pipe.WriteOpen())
    {
        const std::string message("wake up");
        //客户端写
        char ch = 'A';
        while(ch<='M')
        {
            //先向共享内存中写
            shmaddr[ch-'A'] = ch;
            ch++;
            sleep(2);
            //再向命名管道中写
            pipe.WriteForPipe(message);
        }
    }
    return 0;
}